package com.gxa.controller.HhyController;

import com.gxa.mapper.HsExaMapper;
import com.gxa.service.HsExaService;
import com.gxa.utils.R;
import com.gxa.vo.HsExaVo;
import com.gxa.vo.SelectByCardTimeVo;
import com.gxa.vo.SelectFactorVo;
import com.gxa.vo.SelectStatusTimeVo;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Api(tags="核酸检测信息相关接口")
@RestController
public class HsExaController {

    @Autowired
    private HsExaService hsExaService;

    @ApiOperation(value = "检测详情接口", produces = "application/json", response = R.class)
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "Authorization", value = "令牌", paramType = "header", dataType = "String", required = true)
    })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "返回xx详细信息", examples = @io.swagger.annotations.Example(
                    value = {
                            @ExampleProperty(value = "{'code':200,'msg':'描述'}}", mediaType = "application/json")
                    })),
            @ApiResponse(code = 306, message = "登录已超时，请重新登录"),
            @ApiResponse(code = 307, message = "令牌格式不正确"),
            @ApiResponse(code = 401, message = "没有权限"),
            @ApiResponse(code = 403, message = "无效请求，本系统只支持AJAX请求"),
            @ApiResponse(code = 500, message = "服务器内部错误")
    })
    @RequiresPermissions("pre:sel")
    @GetMapping("/hs/hsAllInformation")
    public R hsInformation(){
        List<HsExaVo> list = this.hsExaService.queryAll();
        return R.ok().put("data",list);
    }

    @ApiOperation(value = "条件查询选择接口", produces = "application/json", response = R.class)
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "Authorization", value = "令牌", paramType = "header", dataType = "String", required = true)
    })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "返回xx详细信息", examples = @io.swagger.annotations.Example(
                    value = {
                            @ExampleProperty(value = "{'code':200,'msg':'描述'}}", mediaType = "application/json")
                    })),
            @ApiResponse(code = 306, message = "登录已超时，请重新登录"),
            @ApiResponse(code = 307, message = "令牌格式不正确"),
            @ApiResponse(code = 401, message = "没有权限"),
            @ApiResponse(code = 403, message = "无效请求，本系统只支持AJAX请求"),
            @ApiResponse(code = 500, message = "服务器内部错误")
    })
    @RequiresPermissions("pre:sel")
    @PostMapping("/hs/selectFormat")
    public R selectFormat(@ApiParam(name="selectFormat-为参数名",value = "预约参数--这里写参数描述",required = true)@RequestBody SelectStatusTimeVo selectStatusTimeVo){
        List<HsExaVo> list = this.hsExaService.selectByStatusTime(selectStatusTimeVo);
        return R.ok().put("data",list);
    }
}
